package br.com.pnfp.web.test;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;

import javax.net.ssl.HttpsURLConnection;

public class ConectaSitePrefeitura {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		new ConectaSitePrefeitura().start();
	}
	
	public void start() throws Exception {
		
		URL url = new URL("https://www.nfp.fazenda.sp.gov.br/login.aspx?ReturnUrl=%2fInicio.aspx");
		HttpsURLConnection httpConn = (HttpsURLConnection) url.openConnection();
		
		//httpConn.setRequestMethod("POST");
//		httpConn.setDoOutput(true);
		
		httpConn.addRequestProperty("ctl00$ConteudoPagina$Login1$rblTipo", "rdBtnNaoContribuinte");
		httpConn.addRequestProperty("ctl00$ConteudoPagina$Login1$UserName", "21366327870");
		httpConn.addRequestProperty("ctl00$ConteudoPagina$Login1$Password", "master81");	
		
		httpConn.connect();
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(httpConn.getInputStream()));
		String line;
		while((line = reader.readLine()) != null) {
			System.out.println(line);
		}
		reader.close();
		httpConn.disconnect();
		
	}

}
